#ifndef GREGION_H
#define GREGION_H

#include <QtGui/QDialog>
#include "ui_gregion.h"

#include "config.h"
#include "DB_Manager.h"


class GRegion : public QDialog, public Ui::GRegionClass
{
    Q_OBJECT

public:
    GRegion(QWidget *parent = 0);
    inline void Setdb( DB_Manager *db ) {
    	liner = db;
      init();
    }
    ~GRegion();

private:
   void init();
	DB_Manager *liner;
  QStringList DisplayFields;
  QStringList DTrFields;
  QSqlQueryModel *ReadModel;
  QStandardItemModel *model;
  CheckRow RowUnique;
  QSqlQuery query;
  int LastIdEdit;
  private:
      void EnableEdit( const int id );
      QSqlRecord Fill_Record( QSqlQuery q );
      bool OnBox( int rowposition );
      QList<QStandardItem *> Compose( int rowposition );
      QSqlRecord getNode( int nodeid );
      int Translate_Id_Pos( const int dbid );
	signals:
	public slots:
      void NewCat();
      void ActiveTre( QModelIndex index );
      void RemoveIDs();
      void SaveIDs();
      void MoveIDs();
      void PrintCat();
      void Exporter();
      
};

#endif // GREGION_H
